<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    //数组
        var arr=[1,2,3];
        var sum=0;
    //遍历
        arr.forEach(function(value,index,array){
            console.log(value);
            sum+=value;
        })
        console.log(sum);
    //筛选
       var newArr= arr.filter(function(value){
            return value>=2;
        })
        console.log(newArr);//控制台的2代表数组长度
    //检测是否有满足条件的元素
        var flag=arr.some(function(value){
            return value<4;
        })
        console.log(flag);
    </script>
</body>
</html>